1 00:00:00,750 --> 00:00:01,920 ‫Welcome back. 2 00:00:02,070 --> 00:00:07,830 ‫This is the next to fall in little three, we set up this file, the EPA dopa fire. 3 00:00:08,160 --> 00:00:09,390 ‫We wrote some code here. 4 00:00:10,800 --> 00:00:11,820 ‫We do some good here. 5 00:00:12,180 --> 00:00:19,920 ‫We are able to access our API for the browser, as you can see, but we are not able to access the same 6 00:00:19,920 --> 00:00:22,130 ‫API from within posthuman. 7 00:00:22,410 --> 00:00:27,270 ‫And remember, when you are writing an API, maybe you are writing an EPA to be consumed by a mobile 8 00:00:27,270 --> 00:00:33,840 ‫app outside, or you have another application that you have written for front end that could be running 9 00:00:33,840 --> 00:00:39,840 ‫Angara, that gourami could be running future years or it could be running my favorite front end framework 10 00:00:39,960 --> 00:00:44,640 ‫and that is really G.S. or whatever other framework you're using for your front end. 11 00:00:44,940 --> 00:00:47,490 ‫The applications that you are going to be writing here. 12 00:00:47,670 --> 00:00:52,500 ‫The server side code that you're going to be writing, that we are calling API is going to be consumed 13 00:00:52,500 --> 00:00:53,380 ‫by that application. 14 00:00:53,640 --> 00:00:58,310 ‫It is not going to be running on the browser like this one on Rubirosa, like this one. 15 00:00:58,770 --> 00:01:04,240 ‫Therefore, you need to see or know how to to sort this problem out. 16 00:01:04,710 --> 00:01:08,240 ‫I am going to show you in this section. 17 00:01:08,370 --> 00:01:11,530 ‫So let's jump into Europe next. 18 00:01:11,530 --> 00:01:13,410 ‫Then I would like us, first of all, to click on it. 19 00:01:13,410 --> 00:01:18,030 ‫And here we can just call it this Europea next mustardy series. 20 00:01:18,630 --> 00:01:24,730 ‫And then this is ERP next series for the name. 21 00:01:24,990 --> 00:01:25,620 ‫My study. 22 00:01:27,270 --> 00:01:27,800 ‫My study. 23 00:01:27,850 --> 00:01:29,040 ‫Yep, that's it. 24 00:01:29,370 --> 00:01:30,420 ‫And the item group. 25 00:01:30,420 --> 00:01:33,570 ‫Let me just say, this is obviously remember, this is this year. 26 00:01:33,810 --> 00:01:36,030 ‫This is for the purpose of this demo only. 27 00:01:36,330 --> 00:01:43,200 ‫I don't want to add in stock and a bit of music in the unit, OK, and I save it and let me finish this 28 00:01:43,200 --> 00:01:43,350 ‫one. 29 00:01:43,350 --> 00:01:47,400 ‫Now I am going to find that they have a new application here if I check my database. 30 00:01:47,400 --> 00:01:49,950 ‫Likewise, I have an application here. 31 00:01:49,950 --> 00:01:52,330 ‫So my database now has one item. 32 00:01:52,360 --> 00:01:52,800 ‫Right. 33 00:01:53,400 --> 00:01:57,210 ‫Let me try and refresh my application here and I don't get anything yet. 34 00:01:57,780 --> 00:01:58,290 ‫Why? 35 00:01:58,590 --> 00:01:59,360 ‫I do not know. 36 00:01:59,730 --> 00:02:00,600 ‫Let us find out. 37 00:02:00,870 --> 00:02:06,000 ‫So what you are supposed to do here, you can see that this one is returning zero as well. 38 00:02:06,240 --> 00:02:09,900 ‫So let me try and restart my server and see what happens. 39 00:02:12,390 --> 00:02:18,130 ‫So my service restarting, I can run this one just to make sure that my server is ready. 40 00:02:23,800 --> 00:02:29,210 ‫OK, my staff is still getting started, this one is running, try and refresh your browser. 41 00:02:29,890 --> 00:02:31,330 ‫He still returns to zero. 42 00:02:31,360 --> 00:02:31,940 ‫Take your time. 43 00:02:31,940 --> 00:02:35,070 ‫You know, there's nothing on the terminal yet. 44 00:02:35,440 --> 00:02:38,090 ‫It's supposed to print is supposed to print on the terminal. 45 00:02:38,650 --> 00:02:40,830 ‫Are the subways still loading? 46 00:02:40,840 --> 00:02:42,490 ‫I can hear my computer screaming. 47 00:02:43,630 --> 00:02:48,910 ‫Benge is kind of heavy, I think, depending on the computer you are using, 48 00:02:51,760 --> 00:02:52,570 ‫kids running. 49 00:02:52,570 --> 00:02:56,590 ‫And then he is doing a lot of get, get, get, get stuff. 50 00:02:57,490 --> 00:03:01,360 ‫So reload, see whether it is it best to drop something on the. 51 00:03:02,890 --> 00:03:03,790 ‫No, not yet. 52 00:03:08,080 --> 00:03:09,710 ‫He's doing is still doing its thing here. 53 00:03:12,040 --> 00:03:18,160 ‫So basically what I wanted to show you is that when you because it's not jumping up, when you when 54 00:03:18,160 --> 00:03:22,410 ‫you know this Broza, it's not still going to show you the item that you have added here. 55 00:03:22,780 --> 00:03:29,080 ‫And that is because when you come back to our API, we have told AP to print stuff on the Tamino. 56 00:03:29,080 --> 00:03:30,800 ‫So we have not it to return anything. 57 00:03:31,090 --> 00:03:35,760 ‫So if you need to return, this is how you need to know this in an API. 58 00:03:36,020 --> 00:03:37,150 ‫So this is very critical. 59 00:03:37,420 --> 00:03:41,890 ‫You need to have a written statement if you need to return anything from your API. 60 00:03:41,890 --> 00:03:44,060 ‫And what you have here is what I'm going to stand here. 61 00:03:44,350 --> 00:03:50,260 ‫So now in this case, I do not need the return to the print statement because it's not the execution 62 00:03:50,260 --> 00:03:53,700 ‫is not going to get there in and if it comes in full before they're done. 63 00:03:54,100 --> 00:03:55,750 ‫So I am returning something now. 64 00:03:57,220 --> 00:03:58,870 ‫Oh, this thing has painted. 65 00:03:59,050 --> 00:04:02,620 ‫So you can see before before it what it was doing. 66 00:04:02,620 --> 00:04:08,920 ‫Also, all the rules I have done it is pasting our application on the terminal here. 67 00:04:09,130 --> 00:04:10,840 ‫OK, so all the rules. 68 00:04:10,840 --> 00:04:11,950 ‫I have no idea Aspies that. 69 00:04:11,950 --> 00:04:16,720 ‫Here, let me first of all, let me undo here up to that point. 70 00:04:17,450 --> 00:04:19,020 ‫And how many do we have? 71 00:04:19,030 --> 00:04:21,370 ‫We have one, two, three. 72 00:04:21,730 --> 00:04:27,430 ‫And let me load the browser again, Lord, and see what we have here. 73 00:04:27,550 --> 00:04:28,410 ‫We have another one. 74 00:04:28,420 --> 00:04:33,680 ‫You see, they say this is an object here and you can see your brother theory does nothing. 75 00:04:33,700 --> 00:04:38,410 ‫So when you come to the terminal, we have this database that here this is the item that we have just 76 00:04:38,410 --> 00:04:38,830 ‫added. 77 00:04:39,070 --> 00:04:40,750 ‫You can see that the item code is this one. 78 00:04:40,760 --> 00:04:42,190 ‫This is the name in the database. 79 00:04:42,640 --> 00:04:47,980 ‫And then we have all other services, including the description with the description, European examples 80 00:04:47,980 --> 00:04:52,690 ‫that like this is to have added ideally, this is the item that we have here. 81 00:04:52,930 --> 00:05:00,550 ‫OK, so if you want this browser to print anything here, like, I will see you need to print so I can 82 00:05:00,550 --> 00:05:03,610 ‫leave that one there and you need to return, not print. 83 00:05:03,820 --> 00:05:04,930 ‫You need to return something. 84 00:05:04,930 --> 00:05:07,320 ‫And I want us to return the items in this case. 85 00:05:07,330 --> 00:05:10,680 ‫So these items, whatever we are going to get here is what I want to return. 86 00:05:10,960 --> 00:05:16,660 ‫And now when I go to my browser and reload, I am going to see the same thing that was coming back on 87 00:05:16,660 --> 00:05:17,180 ‫the terminal. 88 00:05:17,200 --> 00:05:23,530 ‫So the exact thing that is here is what I am seeing now on my browser. 89 00:05:23,750 --> 00:05:28,420 ‫Remember, still, we are not able to access this thing using postmarks, but I'm going to I'm going 90 00:05:28,420 --> 00:05:29,260 ‫to come back to this. 91 00:05:29,390 --> 00:05:30,200 ‫Don't worry about that. 92 00:05:30,580 --> 00:05:37,000 ‫So what I wanted to point out here is remember that your apps need to return whatever you wanted to 93 00:05:37,000 --> 00:05:38,770 ‫return to the applications. 94 00:05:38,770 --> 00:05:44,260 ‫And this is how you are going to send data from your app to other from your API to other applications. 95 00:05:44,320 --> 00:05:51,730 ‫So now why is Postman complaining that we do not have permissions to do this? 96 00:05:52,960 --> 00:05:55,920 ‫And that is what I'm about to show you if you want to. 97 00:05:55,930 --> 00:06:01,780 ‫You remember when we were introducing this, this, this, this, this cause I told you that there are 98 00:06:01,780 --> 00:06:06,940 ‫two types of apps, this one area that is open to the public and there's another application that we 99 00:06:06,940 --> 00:06:08,530 ‫need you to authenticate it. 100 00:06:09,010 --> 00:06:16,600 ‫Now, this is an exact this is the kind of an API that needs you to authenticate before it can do whatever 101 00:06:16,600 --> 00:06:18,100 ‫you are requesting it to do here. 102 00:06:18,490 --> 00:06:24,450 ‫So how you went with the ticket, it had to your application go to users. 103 00:06:24,700 --> 00:06:30,250 ‫OK, so I'm teaching, you know, how to authenticate your ticket, your application. 104 00:06:30,430 --> 00:06:40,030 ‫I can select any user here like the administrator, how to authenticate your APIs, selecting the user. 105 00:06:40,030 --> 00:06:47,830 ‫Go to API, scroll down to the application, and then here you have you have the API key and the EPA 106 00:06:47,830 --> 00:06:48,280 ‫talking. 107 00:06:48,550 --> 00:06:50,400 ‫I had generated these some sometimes back. 108 00:06:50,650 --> 00:06:53,350 ‫So if you don't have just click on generate keys. 109 00:06:53,710 --> 00:06:59,350 ‫Let me see what I can get into that note of what I was doing before so I can go back to my postman and 110 00:06:59,350 --> 00:07:03,850 ‫see whether maybe from the history of this application I can get 111 00:07:06,250 --> 00:07:07,780 ‫somewhere I wrote. 112 00:07:08,140 --> 00:07:08,620 ‫Let me see. 113 00:07:08,620 --> 00:07:09,670 ‫One, two, seven. 114 00:07:09,970 --> 00:07:11,140 ‫Yeah I. 115 00:07:11,470 --> 00:07:12,100 ‫Is this. 116 00:07:14,140 --> 00:07:17,950 ‫Yeah I have my own here so I can go to headers. 117 00:07:18,460 --> 00:07:19,720 ‫So what you're going to do. 118 00:07:22,070 --> 00:07:29,720 ‫I have mine now, so what do I going to do after you have generated your case, not the EPA secret before 119 00:07:29,720 --> 00:07:30,390 ‫you close it? 120 00:07:30,410 --> 00:07:36,290 ‫Just take it, take it and maybe put it inside of your port, maybe somewhere within the file, and 121 00:07:36,290 --> 00:07:42,680 ‫also take the EPA key so you have the EPA secret and the EPA and then you head back to your postman 122 00:07:43,010 --> 00:07:44,640 ‫in the header section of the request. 123 00:07:44,720 --> 00:07:47,390 ‫Are trying to make and key. 124 00:07:47,390 --> 00:07:49,660 ‫And that is within the authorization. 125 00:07:50,210 --> 00:07:53,960 ‫So other for authorization and then in the value section. 126 00:07:54,650 --> 00:07:56,590 ‫And then I'm talking. 127 00:07:56,750 --> 00:07:59,420 ‫So you have a token and then here you have two things. 128 00:07:59,420 --> 00:08:02,110 ‫And this is the EPA quién EPA secret that you took. 129 00:08:02,330 --> 00:08:06,210 ‫So make sure that they're following the order of the first one is the EPA key. 130 00:08:06,620 --> 00:08:14,780 ‫So the first one is whatever is here is the EPA key and then the second one will be your EPA secret 131 00:08:15,110 --> 00:08:15,800 ‫between them. 132 00:08:16,280 --> 00:08:19,220 ‫You have a column right now. 133 00:08:19,430 --> 00:08:23,240 ‫When we send this, we are supposed to be able to access this data. 134 00:08:23,240 --> 00:08:31,290 ‫And you can see we have been allowed to access that data from our from our EPA. 135 00:08:31,310 --> 00:08:33,960 ‫So this is the kind of EPA that I told you about it. 136 00:08:33,960 --> 00:08:39,850 ‫It needs the EPA key and the EPA secret to be able to access it. 137 00:08:40,190 --> 00:08:45,740 ‫Now, when you look at this EPA, before I close this one, look at the way this data is shown. 138 00:08:45,740 --> 00:08:47,360 ‫You do not know what is where. 139 00:08:47,720 --> 00:08:50,570 ‫You do not know what is in whatever. 140 00:08:50,570 --> 00:08:51,830 ‫You do not exactly know. 141 00:08:51,830 --> 00:08:52,420 ‫What is this? 142 00:08:52,640 --> 00:08:58,460 ‫This is something that we are going I am going to tell you to teach you in the next lecture and also 143 00:08:58,820 --> 00:09:03,110 ‫look at we cannot access this EPA without our talking. 144 00:09:03,140 --> 00:09:09,140 ‫So if I said this is going to complain that we do not have permission, how about those EPA that you 145 00:09:09,140 --> 00:09:14,660 ‫need to write and you do not need to have the DOE to supply the talking to you to access them? 146 00:09:14,930 --> 00:09:16,130 ‫How are you going to read that? 147 00:09:16,250 --> 00:09:22,460 ‫I am going to be showing you that in the next section on the next section of this discourse, because 148 00:09:22,460 --> 00:09:22,940 ‫so much. 149 00:09:22,940 --> 00:09:24,530 ‫And see you in the next one.